import request from '@/hooks/request'

const Api = {
  fishOrderList: '/fish/order/fishOrderList', // 订单列表
  editOrderRemark: '/fish/order/editOrderRemark', // 编辑订单备注
  refreshOrder: '/fish/order/refreshOrder', // 刷新订单信息
  changePrice: '/fish/order/changePrice', // 改价
  orderCancel: '/fish/order/orderCancel', // 取消订单
  cancelOrderReasonList: '/fish/order/cancelOrderReasonList', // 取消订单原因列表
  sendGoods: '/fish/order/sendGoods', // 发货
  automatePutawayList: '/fish/automatePutaway/automatePutawayList', // 自动上品列表
  cinemaLineBrandList: '/fish/automatePutaway/cinemaLineBrandList', // 院线列表
  cityList: '/fish/automatePutaway/cityList', // 城市列表
  addAutomatePutaway: '/fish/automatePutaway/addAutomatePutaway', // 新增自动上品
  editAutomatePutawayRemark: '/fish/automatePutaway/editAutomatePutawayRemark', // 编辑备注
  deleteAutomatePutaway: '/fish/automatePutaway/deleteAutomatePutaway', // 删除自动上品
  editAutomatePutawayState: '/fish/automatePutaway/editAutomatePutawayState', // 编辑自动上品状态（启动-停止）
  polishGoods: '/fish/product/fishPolishProductList', //自动擦亮商品列表
  automatePolishList: '/fish/polish/automatePolishList', //自动擦亮任务列表
  addAutomatePolish: '/fish/polish/addAutomatePolish', //新增自动擦亮任务
  editAutomatePolish: '/fish/polish/editAutomatePolishState', //  编辑自动擦亮状态（启动-停止）
  deleteAutomatePolish: '/fish/polish/deleteAutomatePolish', //  编辑自动擦亮状态（启动-停止）
  editAutomatePolishRemark: '/fish/polish/editAutomatePolishRemark', //  编辑自动擦亮备注
  automatePolishTaskList: '/fish/polish/automatePolishTaskList', //查询自动擦亮任务记录列表
  automatePutawayTaskList: '/fish/automatePutaway/automatePutawayTaskList', // 自动上品 - 任务进度列表
  refundOrder: '/fish/order/refundOrder', // 闲鱼-退款订单详情
  fishRefundOrderList: '/fish/order/fishRefundOrderList', // 闲鱼-退款订单
  editRefundOrderRemark: '/fish/order/editRefundOrderRemark', // 闲鱼-退款订单 - 修改备注
  orderDealRefund: '/fish/order/orderDealRefund', // 闲鱼-退款订单 - 同意
  getFishIndustryCategory: 'fish/category/getFishIndustryCategory', // 闲鱼-行业类目
  fishIndustryCategoryPushRobots: '/fish/category/fishIndustryCategoryPushRobots', // 闲鱼-推送行业类目关键字
  fishOrderExcelOut: '/fish/order/fishOrderExcelOut', // 订单导出
}

export const fishOrderExcelOut = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.fishOrderExcelOut,
    data: parameter,
    responseType: 'blob'
  })
}

export const fishIndustryCategoryPushRobots = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.fishIndustryCategoryPushRobots,
    data: parameter,
  })
}

export const getFishIndustryCategory = (parameter: Record<any, any>) => {
  const formData = new FormData()
  formData.append('robotId', parameter.robotId)
  return request({
    method: 'post',
    url: Api.getFishIndustryCategory,
    data: formData,
  })
}

export const orderDealRefund = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.orderDealRefund,
    data: parameter,
  })
}

export const editRefundOrderRemark = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.editRefundOrderRemark,
    data: parameter,
  })
}

export const fishRefundOrderList = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.fishRefundOrderList,
    data: parameter,
  })
}

export const fishOrderList = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.fishOrderList,
    data: parameter,
  })
}

export const editOrderRemark = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.editOrderRemark,
    data: parameter,
  })
}

export const refreshOrder = (parameter: Record<any, any>) => {
  const formData = new FormData()
  formData.append('id', parameter.id)
  return request({
    method: 'post',
    url: Api.refreshOrder,
    data: formData,
  })
}

export const changePrice = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.changePrice,
    data: parameter,
  })
}

export const orderCancel = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.orderCancel,
    data: parameter,
  })
}

export const sendGoods = (parameter: Record<any, any>) => {
  // const formData = new FormData()
  // formData.append('id', parameter.id)
  return request({
    method: 'post',
    url: Api.sendGoods,
    data: parameter,
  })
}

export const automatePutawayList = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.automatePutawayList,
    data: parameter,
  })
}

export const cinemaLineBrandList = () => {
  return request({
    method: 'post',
    url: Api.cinemaLineBrandList,
  })
}

export const cityList = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.cityList,
    data: parameter,
  })
}

export const addAutomatePutaway = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.addAutomatePutaway,
    data: parameter,
  })
}

export const editAutomatePutawayRemark = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.editAutomatePutawayRemark,
    data: parameter,
  })
}

export const editAutomatePutawayState = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.editAutomatePutawayState,
    data: parameter,
  })
}

export const deleteAutomatePutaway = (parameter: Record<any, any>) => {
  const formData = new FormData()
  formData.append('id', parameter.id)
  return request({
    method: 'post',
    url: Api.deleteAutomatePutaway,
    data: formData,
  })
}

export const getPolishGoods = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.polishGoods,
    data: parameter,
  })
}

export const getTaskListByPolish = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.automatePolishList,
    data: parameter,
  })
}
export const addPolishTask = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.addAutomatePolish,
    data: parameter,
  })
}

export const deleteAutomatePolish = (parameter: Record<any, any>) => {
  const formData = new FormData()
  formData.append('polishId', parameter.polishId)
  return request({
    method: 'post',
    url: Api.deleteAutomatePolish,
    data: formData,
  })
}

export const editAutomatePolish = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.editAutomatePolish,
    data: parameter,
  })
}

export const editAutomatePolishRemark = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.editAutomatePolishRemark,
    data: parameter,
  })
}

export const automatePolishTaskList = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.automatePolishTaskList,
    data: parameter,
  })
}

export const automatePutawayTaskList = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.automatePutawayTaskList,
    data: parameter,
  })
}

export const cancelOrderReasonList = () => {
  return request({
    method: 'post',
    url: Api.cancelOrderReasonList,
  })
}

export const refundOrder = (parameter: Record<any, any>) => {
  const formData = new FormData()
  formData.append('id', parameter.id)
  return request({
    method: 'post',
    url: Api.refundOrder,
    data: formData,
  })
}
